refactor(ai): rename provider id ai-gateway → vercel#788
Conversation
The BYOK provider id "ai-gateway" was misleading — it's a service name,
not a provider identity. Renamed to "vercel" to match how the other
entry ("openrouter") names its provider. Also renames the routing label
on @grida/ai-models cards from "gateway" to "vercel" for the same
reason.
- ByokProviderId: "ai-gateway" → "vercel" (label "AI Gateway" → "Vercel")
- models.Provider: "gateway" → "vercel" (1 type + 10 image-model cards)
- makeAiGatewayFactory → makeVercelFactory
- Sandbox policy key renamed; allowlisted hosts unchanged
(ai-gateway.vercel.sh, *.vercel-ai.com — these are real URLs)
- BYOK_AI_GATEWAY_API_KEY env var preserved (mirrors Vercel's own
AI_GATEWAY_API_KEY convention); "AI Gateway" prose preserved where
it names the product
Breaking — by design, no compat shim:
- Local auth.json entries keyed "ai-gateway" are orphaned; desktop
users will need to re-enter their Vercel BYOK key
- /secrets/* HTTP routes will 400 on provider_id: "ai-gateway"
- @grida/ai-models consumers will see provider: "vercel" on cards
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Worried about impact? Review this PR in Change Stack to explore blast radius before you approve or request changes. WalkthroughThis PR updates the bring-your-own-key (BYOK) provider identifier and associated configuration throughout the codebase. The provider named "ai-gateway" is being renamed to "vercel" across type definitions, factory implementations, network policies, and documentation, while preserving the OpenRouter-first fallback precedence behavior. ChangesBYOK Provider Identifier Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/grida-ai-agent/src/auth/file.ts (1)
138-138:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix CI-blocking typo in comment.
unparseableshould beunparsableto satisfy the typos check.Suggested patch
- // override was unparseable — fall through to disk + // override was unparsable — fall through to disk🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/grida-ai-agent/src/auth/file.ts` at line 138, Update the comment containing "override was unparseable — fall through to disk" in packages/grida-ai-agent/src/auth/file.ts to correct the spelling from "unparseable" to "unparsable"; locate the comment text (the line with "override was unparseable") and change only that word so the typos check passes without altering surrounding code or logic.Source: Pipeline failures
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/grida-ai-agent/src/auth/file.ts`:
- Line 138: Update the comment containing "override was unparseable — fall
through to disk" in packages/grida-ai-agent/src/auth/file.ts to correct the
spelling from "unparseable" to "unparsable"; locate the comment text (the line
with "override was unparseable") and change only that word so the typos check
passes without altering surrounding code or logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 08be8851-dd33-4d95-9e7d-6bc9fc2dd1af
📒 Files selected for processing (16)
docs/contributing/billing.mddocs/wg/ai/grida/architecture.mdeditor/.env.exampleeditor/lib/ai/models.tseditor/lib/desktop/bridge.test.tspackages/grida-ai-agent/src/__public-api__.test.tspackages/grida-ai-agent/src/auth/file.tspackages/grida-ai-agent/src/http/routes/secrets.tspackages/grida-ai-agent/src/protocol/provider-ids.tspackages/grida-ai-agent/src/providers/byok.tspackages/grida-ai-agent/src/providers/index.test.tspackages/grida-ai-agent/src/providers/index.tspackages/grida-ai-agent/src/sandbox/policy.tspackages/grida-ai-agent/src/secrets.tspackages/grida-ai-models/__tests__/models.test.tspackages/grida-ai-models/src/models.ts
Summary
The BYOK provider id
"ai-gateway"was misleading — it's a service name, not a provider identity. Renamed to"vercel"to match how"openrouter"names its provider. Also renames the routing label on@grida/ai-modelsimage-model cards from"gateway"to"vercel"for the same reason.ByokProviderId(@grida/agent):"ai-gateway"→"vercel"(label"AI Gateway"→"Vercel")models.Provider(@grida/ai-models):"gateway"→"vercel"(1 type + 10 image-model cards)makeAiGatewayFactory→makeVercelFactoryai-gateway.vercel.sh,*.vercel-ai.com— those are the real URLs)Preserved (intentional)
BYOK_AI_GATEWAY_API_KEYenv var stays — it mirrors Vercel's ownAI_GATEWAY_API_KEYconvention; no point fighting upstream naming.vercel.com/docs/ai-gateway/...URLs.Breaking — by design, no compat shim
auth.jsonentries keyed"ai-gateway"are orphaned; desktop users will need to re-enter their Vercel BYOK key via the settings UI./secrets/*HTTP routes will rejectprovider_id: "ai-gateway"with 400; old desktop bridge clients sending the legacy id will fail.@grida/ai-modelsconsumers reading theproviderfield on image-model cards will see"vercel"instead of"gateway".Verification
pnpm turbo build --filter=@grida/ai-models --filter=@grida/agent✅pnpm turbo test --filter=@grida/ai-models --filter=@grida/agent✅ 350 testspnpm exec vitest run lib/ai/__tests__/server.test.ts lib/desktop/bridge.test.ts✅ 20 testspnpm turbo typecheck --filter=editor✅ 38 tasks (editor + all deps)Test plan
"Vercel"auth.jsoncorrectlyBYOK_AI_GATEWAY_API_KEYenv var still activates the BYOK pathSummary by CodeRabbit
New Features
Documentation